import { FileChangeUtil } from "./FileChangeUtil";
import { Main } from "../Main";
import * as fs from "fs";
import { ShellUtil } from "./ShellUtil";
import { DirUtil } from "./DirUtil";

/**
 * csd2lua工具
 * @author 赵占涛
 */
export class Csd2LuaUtil {
    static export(csd:string, lua:string, cb:()=>void) {
        DirUtil.confirmDirExist(lua, ()=>{
            ShellUtil.exec(`
                cd ${Main.projPath}easyscript/lib/csd2lua/ || exit 1
                lua ${Main.projPath}easyscript/lib/csd2lua/csd2luaEnter.lua ${csd} ${lua} || exit 1
            `, cb);
        })
    }
}